package com.bigstar.lolkor;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;

public class MyWaitDialog extends Dialog {

	Context mContext;

	public MyWaitDialog(Context context) {
		super(context);
		mContext = context;
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		this.setContentView(R.layout.my_wait);
		getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK) {
			AlertDialogMessage("작업이 완료되지 않았습니다. ");
		}
		return super.onKeyDown(keyCode, event);
	}

	private void AlertDialogMessage(String strMsg) {
		AlertDialog.Builder ab = null;
		ab = new AlertDialog.Builder(mContext);
		ab.setMessage(strMsg);
		ab.setPositiveButton("확인", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int id) {
				
				dismiss();
			}
		});

		ab.setTitle("알림");
		ab.show();
	}	
}
